<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>

    </body>
</html>
<script>
    var c1={
        name:"科迈罗",
        length:2.4,
        price:39.9,
    }

    var c2={
        name:"本田crv",
        length: 2.7,
        price:25.6,
    }

    var c3={
        name:"本田雅阁08款",
        length:2.3,
        price:21.6,
    }

var bc={c1,c2,c3}
    function car(bc) {
        for (var j =0 ; j<car.length - 1; j++){
            for (var i=0 ; i<car.length - 1 - j; i++){
                if (car[i].price > car[i+1].price){
                    var temp =car[i];
                    car[i] =car[i+1];
                    car[i+1]=temp;
                }
            }
        }
    }
    car(bc);
    console.log(bc);
</script>